package com.leadingsoft.pwxk.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leadingsoft.pwxk.converter.AirPermitInfoConverter;
import com.leadingsoft.pwxk.dto.AirPermitInfoDto;
import com.leadingsoft.pwxk.model.AirPermitInfo;
import com.leadingsoft.pwxk.repository.AirPermitInfoRepository;
import com.leadingsoft.pwxk.service.AirPermitInfoService;

/**
 * @author: lipan 2018年5月17日
 * @description: ( 大气污染 -企业大气排放总许可量信息 )
 * 
 */

@Service
public class AirPermitInfoServiceImpl implements AirPermitInfoService {

	@Autowired
	private AirPermitInfoRepository airPermitInfoRepository;

	@Autowired
	private AirPermitInfoConverter airPermitInfoConverter;

	@Override
	public AirPermitInfoDto get(String dataid) {
		List<AirPermitInfo> findByDataid = airPermitInfoRepository.findByDataid(dataid);
		return airPermitInfoConverter.toDto(findByDataid == null ? null : findByDataid.get(0));
	}

	@Override
	public List<AirPermitInfoDto> findByDataId(String dataid) {
		return airPermitInfoConverter.toDto(airPermitInfoRepository.findByDataid(dataid));
	}

}
